﻿namespace Borg.AttributeAnalyze.Result
{
    public class MissingParameter : ResultBase
    {
        private readonly ParamDefinition _paramDef;
        private readonly PlugTypeInfo _plug;

        public MissingParameter(PlugTypeInfo plug, ParamDefinition parameterDefinition)
            : base(plug.Assembly, Component.Plug, ResultType.MissingParameter, plug, plug.ExtensionTypeInfo)
        {
            _plug = plug;
            _paramDef = parameterDefinition;
        }

        public override string ToMsBuildMessageString()
        {
            return string.Format(
                "missing parameter\n{0}slot name: {1}\n{0}class: {2}\n{0}parameter name: {3}\n{0}parameter type: {4}",
                new object[] { GetWhiteSpace(2), Name, TypeName, _paramDef.Name, _paramDef.Type.Name });
        }

        public override MessageType MessageType
        {
            get { return MessageType.Error; }
        }
    }
}

